Project 3 House Energy Consumption

Introduction: this project is to analyze data from 2016 house energy consumption in order to research how it impact on our life.

Where house energy consumption go?

How much house energy consumption cost?

How impact on our life?

Importing Library

In [1]:
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import numpy as np

Loading CSV File

In [2]:
data = pd.read_csv('E:\Project 3\Energy-saving House.csv')
data
C:\Users\Admin\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3071: DtypeWarning: Columns (0,27) have mixed types.Specify dtype option on import or set low_memory=False.
  has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
Out[2]:
time use [kW] gen [kW] House overall [kW] Dishwasher [kW] Furnace 1 [kW] Furnace 2 [kW] Home office [kW] Fridge [kW] Wine cellar [kW] ... visibility summary apparentTemperature pressure windSpeed cloudCover windBearing precipIntensity dewPoint precipProbability
0 1451624400 0.932833 0.003483 0.932833 0.000033 0.020700 0.061917 0.442633 0.124150 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
1 1451624401 0.934333 0.003467 0.934333 0.000000 0.020717 0.063817 0.444067 0.124000 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2 1451624402 0.931817 0.003467 0.931817 0.000017 0.020700 0.062317 0.446067 0.123533 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
3 1451624403 1.022050 0.003483 1.022050 0.000017 0.106900 0.068517 0.446583 0.123133 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
4 1451624404 1.139400 0.003467 1.139400 0.000133 0.236933 0.063983 0.446533 0.122850 0.006850 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
503906 1452128306 1.599333 0.003233 1.599333 0.000050 0.104017 0.625033 0.041750 0.005233 0.008433 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
503907 1452128307 1.924267 0.003217 1.924267 0.000033 0.422383 0.637733 0.042033 0.004983 0.008467 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
503908 1452128308 1.978200 0.003217 1.978200 0.000050 0.495667 0.620367 0.042100 0.005333 0.008233 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
503909 1452128309 1.990950 0.003233 1.990950 0.000050 0.494700 0.634133 0.042100 0.004917 0.008133 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
503910 \ NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

503911 rows × 32 columns

Converting Time from UNIX Format to Readable Format

In [3]:
time_index = pd.date_range('2016-01-01 00:00:00', periods=len(data),  freq='min')  
time_index = pd.DatetimeIndex(time_index)
data = data.set_index(time_index)
data['time']=time_index
data
Out[3]:
time use [kW] gen [kW] House overall [kW] Dishwasher [kW] Furnace 1 [kW] Furnace 2 [kW] Home office [kW] Fridge [kW] Wine cellar [kW] ... visibility summary apparentTemperature pressure windSpeed cloudCover windBearing precipIntensity dewPoint precipProbability
2016-01-01 00:00:00 2016-01-01 00:00:00 0.932833 0.003483 0.932833 0.000033 0.020700 0.061917 0.442633 0.124150 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:01:00 2016-01-01 00:01:00 0.934333 0.003467 0.934333 0.000000 0.020717 0.063817 0.444067 0.124000 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:02:00 2016-01-01 00:02:00 0.931817 0.003467 0.931817 0.000017 0.020700 0.062317 0.446067 0.123533 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:03:00 2016-01-01 00:03:00 1.022050 0.003483 1.022050 0.000017 0.106900 0.068517 0.446583 0.123133 0.006983 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:04:00 2016-01-01 00:04:00 1.139400 0.003467 1.139400 0.000133 0.236933 0.063983 0.446533 0.122850 0.006850 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2016-12-15 22:26:00 2016-12-15 22:26:00 1.599333 0.003233 1.599333 0.000050 0.104017 0.625033 0.041750 0.005233 0.008433 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:27:00 2016-12-15 22:27:00 1.924267 0.003217 1.924267 0.000033 0.422383 0.637733 0.042033 0.004983 0.008467 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:28:00 2016-12-15 22:28:00 1.978200 0.003217 1.978200 0.000050 0.495667 0.620367 0.042100 0.005333 0.008233 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:29:00 2016-12-15 22:29:00 1.990950 0.003233 1.990950 0.000050 0.494700 0.634133 0.042100 0.004917 0.008133 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:30:00 2016-12-15 22:30:00 NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

503911 rows × 32 columns

From the above, the time recorded in the dataset is from 2016-01-01 00:00:00 to 2016-12-15 22:29:00.

Removing Invalid Row

In [4]:
data = data[0:-1]
data.shape
Out[4]:
(503910, 32)

Dropping Same Columns

In [5]:
data['use [kW]'].head()
Out[5]:
2016-01-01 00:00:00    0.932833
2016-01-01 00:01:00    0.934333
2016-01-01 00:02:00    0.931817
2016-01-01 00:03:00    1.022050
2016-01-01 00:04:00    1.139400
Freq: T, Name: use [kW], dtype: float64
In [6]:
data['House overall [kW]'].head()
Out[6]:
2016-01-01 00:00:00    0.932833
2016-01-01 00:01:00    0.934333
2016-01-01 00:02:00    0.931817
2016-01-01 00:03:00    1.022050
2016-01-01 00:04:00    1.139400
Freq: T, Name: House overall [kW], dtype: float64
In [7]:
(data['use [kW]']-data['House overall [kW]']).value_counts()
Out[7]:
0.0    503910
dtype: int64
In [8]:
fig, axes = plt.subplots(nrows=2, ncols=1)
data['use [kW]'].plot(ax=axes[0],figsize=(20,7))
data['House overall [kW]'].plot(ax=axes[1],figsize=(20,7))
Out[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x24008f3ee20>
In [9]:
data = data.drop(columns = 'use [kW]')
data
Out[9]:
time gen [kW] House overall [kW] Dishwasher [kW] Furnace 1 [kW] Furnace 2 [kW] Home office [kW] Fridge [kW] Wine cellar [kW] Garage door [kW] ... visibility summary apparentTemperature pressure windSpeed cloudCover windBearing precipIntensity dewPoint precipProbability
2016-01-01 00:00:00 2016-01-01 00:00:00 0.003483 0.932833 0.000033 0.020700 0.061917 0.442633 0.124150 0.006983 0.013083 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:01:00 2016-01-01 00:01:00 0.003467 0.934333 0.000000 0.020717 0.063817 0.444067 0.124000 0.006983 0.013117 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:02:00 2016-01-01 00:02:00 0.003467 0.931817 0.000017 0.020700 0.062317 0.446067 0.123533 0.006983 0.013083 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:03:00 2016-01-01 00:03:00 0.003483 1.022050 0.000017 0.106900 0.068517 0.446583 0.123133 0.006983 0.013000 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:04:00 2016-01-01 00:04:00 0.003467 1.139400 0.000133 0.236933 0.063983 0.446533 0.122850 0.006850 0.012783 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2016-12-15 22:25:00 2016-12-15 22:25:00 0.003183 1.601233 0.000050 0.085267 0.642417 0.041783 0.005267 0.008667 0.013483 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:26:00 2016-12-15 22:26:00 0.003233 1.599333 0.000050 0.104017 0.625033 0.041750 0.005233 0.008433 0.013433 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:27:00 2016-12-15 22:27:00 0.003217 1.924267 0.000033 0.422383 0.637733 0.042033 0.004983 0.008467 0.012933 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:28:00 2016-12-15 22:28:00 0.003217 1.978200 0.000050 0.495667 0.620367 0.042100 0.005333 0.008233 0.012817 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:29:00 2016-12-15 22:29:00 0.003233 1.990950 0.000050 0.494700 0.634133 0.042100 0.004917 0.008133 0.012833 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51

503910 rows × 31 columns

In [10]:
data['gen [kW]'].head()
Out[10]:
2016-01-01 00:00:00    0.003483
2016-01-01 00:01:00    0.003467
2016-01-01 00:02:00    0.003467
2016-01-01 00:03:00    0.003483
2016-01-01 00:04:00    0.003467
Freq: T, Name: gen [kW], dtype: float64
In [11]:
data['Solar [kW]'].head()
Out[11]:
2016-01-01 00:00:00    0.003483
2016-01-01 00:01:00    0.003467
2016-01-01 00:02:00    0.003467
2016-01-01 00:03:00    0.003483
2016-01-01 00:04:00    0.003467
Freq: T, Name: Solar [kW], dtype: float64
In [12]:
(data['gen [kW]']-data['Solar [kW]']).value_counts()
Out[12]:
0.0    503910
dtype: int64
In [13]:
fig, axes = plt.subplots(nrows=2, ncols=1)
data['gen [kW]'].plot(ax=axes[0],figsize=(20,7))
data['Solar [kW]'].plot(ax=axes[1],figsize=(20,7))
Out[13]:
<matplotlib.axes._subplots.AxesSubplot at 0x2400a1bf1c0>
In [14]:
data = data.drop(columns = ['gen [kW]'])
data
Out[14]:
time House overall [kW] Dishwasher [kW] Furnace 1 [kW] Furnace 2 [kW] Home office [kW] Fridge [kW] Wine cellar [kW] Garage door [kW] Kitchen 12 [kW] ... visibility summary apparentTemperature pressure windSpeed cloudCover windBearing precipIntensity dewPoint precipProbability
2016-01-01 00:00:00 2016-01-01 00:00:00 0.932833 0.000033 0.020700 0.061917 0.442633 0.124150 0.006983 0.013083 0.000417 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:01:00 2016-01-01 00:01:00 0.934333 0.000000 0.020717 0.063817 0.444067 0.124000 0.006983 0.013117 0.000417 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:02:00 2016-01-01 00:02:00 0.931817 0.000017 0.020700 0.062317 0.446067 0.123533 0.006983 0.013083 0.000433 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:03:00 2016-01-01 00:03:00 1.022050 0.000017 0.106900 0.068517 0.446583 0.123133 0.006983 0.013000 0.000433 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
2016-01-01 00:04:00 2016-01-01 00:04:00 1.139400 0.000133 0.236933 0.063983 0.446533 0.122850 0.006850 0.012783 0.000450 ... 10.00 Clear 29.26 1016.91 9.18 cloudCover 282.0 0.0000 24.40 0.00
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2016-12-15 22:25:00 2016-12-15 22:25:00 1.601233 0.000050 0.085267 0.642417 0.041783 0.005267 0.008667 0.013483 0.000467 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:26:00 2016-12-15 22:26:00 1.599333 0.000050 0.104017 0.625033 0.041750 0.005233 0.008433 0.013433 0.000467 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:27:00 2016-12-15 22:27:00 1.924267 0.000033 0.422383 0.637733 0.042033 0.004983 0.008467 0.012933 0.000533 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:28:00 2016-12-15 22:28:00 1.978200 0.000050 0.495667 0.620367 0.042100 0.005333 0.008233 0.012817 0.000517 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51
2016-12-15 22:29:00 2016-12-15 22:29:00 1.990950 0.000050 0.494700 0.634133 0.042100 0.004917 0.008133 0.012833 0.000517 ... 8.74 Light Rain 29.45 1011.49 6.72 0.31 186.0 0.0101 31.27 0.51

503910 rows × 30 columns

Separating data into overall house data, house data, and solar data.

In [15]:
house_overall_data = data.filter(items=['House overall [kW]'])

house_data = data.filter(items=['Dishwasher [kW]', 'Furnace 1 [kW]', 
                                'Furnace 2 [kW]', 'Home office [kW]', 
                                'Fridge [kW]', 'Wine cellar [kW]', 
                                'Garage door [kW]', 'Kitchen 12 [kW]', 
                                'Kitchen 14 [kW]', 'Kitchen 38 [kW]', 
                                'Barn [kW]', 'Well [kW]', 
                                'Microwave [kW]', 'Living room [kW]'])
                                
solar_data = data.filter(items=['Solar [kW]'])                            
In [16]:
house_overall_data.head()
Out[16]:
House overall [kW]
2016-01-01 00:00:00 0.932833
2016-01-01 00:01:00 0.934333
2016-01-01 00:02:00 0.931817
2016-01-01 00:03:00 1.022050
2016-01-01 00:04:00 1.139400
In [17]:
house_data.head()
Out[17]:
Dishwasher [kW] Furnace 1 [kW] Furnace 2 [kW] Home office [kW] Fridge [kW] Wine cellar [kW] Garage door [kW] Kitchen 12 [kW] Kitchen 14 [kW] Kitchen 38 [kW] Barn [kW] Well [kW] Microwave [kW] Living room [kW]
2016-01-01 00:00:00 0.000033 0.020700 0.061917 0.442633 0.124150 0.006983 0.013083 0.000417 0.000150 0.000000 0.031350 0.001017 0.004067 0.001517
2016-01-01 00:01:00 0.000000 0.020717 0.063817 0.444067 0.124000 0.006983 0.013117 0.000417 0.000150 0.000000 0.031500 0.001017 0.004067 0.001650
2016-01-01 00:02:00 0.000017 0.020700 0.062317 0.446067 0.123533 0.006983 0.013083 0.000433 0.000167 0.000017 0.031517 0.001000 0.004067 0.001650
2016-01-01 00:03:00 0.000017 0.106900 0.068517 0.446583 0.123133 0.006983 0.013000 0.000433 0.000217 0.000000 0.031500 0.001017 0.004067 0.001617
2016-01-01 00:04:00 0.000133 0.236933 0.063983 0.446533 0.122850 0.006850 0.012783 0.000450 0.000333 0.000000 0.031500 0.001017 0.004067 0.001583
In [18]:
solar_data.head()
Out[18]:
Solar [kW]
2016-01-01 00:00:00 0.003483
2016-01-01 00:01:00 0.003467
2016-01-01 00:02:00 0.003467
2016-01-01 00:03:00 0.003483
2016-01-01 00:04:00 0.003467

Plotting Overall House Data on October 7, 2016

In [19]:
# Set the width and height of the figure
plt.figure(figsize=(20,7))

# Add title
plt.title("House Overall Energy Consumption on October 7, 2016")

sns.lineplot(data = house_overall_data.loc['2016-10-07 00:00':'2016-10-07 23:59'].resample(
                                           'H').sum(), dashes=False)
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x24034c6deb0>

From the above plot: the highest overall house energy consumption is at 6:00 on October 7, 2016; the lowest overall house energy consumption is at 13:00 on October 7, 2016.

Plotting Overall House Data per Month

In [20]:
plt.figure(figsize=(20,7))
plt.title("Overall House Energy Consumption per Month")
sns.lineplot(data = house_overall_data.resample('M').sum(), dashes=False)
Out[20]:
<matplotlib.axes._subplots.AxesSubplot at 0x240349d7370>

From the above plot: the highest energy consumption is in August and September; the lowest energy consumption is in July and December.

Plotting Specific House Data on October 7, 2016

In [21]:
plt.figure(figsize=(20,7))
plt.title("Specific House Energy Consumption on October 7, 2016")
sns.lineplot(data = house_data.loc['2016-10-07 00:00':'2016-10-07 23:59'].resample(
                                            'H').sum(), dashes=False)
Out[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x24034cca910>

From the above plot: higher house energy consumption shows from 6:00 to 12:00. During this period time, living room and barn has higher energy consumption and is quite lively.

Plotting Specific House Data per Month

In [22]:
plt.figure(figsize=(20,7))
plt.title("Specific House Energy Consumption per Month")
sns.lineplot(data = house_data.resample('M').sum(), dashes=False)
Out[22]:
<matplotlib.axes._subplots.AxesSubplot at 0x2403c15ed90>

From the above plot: furnace 2 and 1 has the higher energy consumption in the house before May 2016.

Plotting Solar Power Generation on October 7, 2016

In [23]:
plt.figure(figsize=(20,7))
plt.title("Solar Power Generation on October 7, 2016")
sns.lineplot(data = solar_data.loc['2016-10-07 00:00':'2016-10-07 23:59'].resample('H').sum(), 
                                                                          dashes=False)
Out[23]:
<matplotlib.axes._subplots.AxesSubplot at 0x24003d9ca90>

From above plot: solar generates the stronger power between 11:00 and 13:00 on October 7, 2016.

Plotting Solar Power Generation Per Month

In [24]:
plt.figure(figsize=(20,7))
plt.title("Solar Power Generation per Month")
sns.lineplot(data = solar_data.resample('M').sum(), dashes=False)
Out[24]:
<matplotlib.axes._subplots.AxesSubplot at 0x2403bc46820>

From above plot: solar generates the strongest power in July; solar generates the weakest power in December and January.

Comparing Overall House Energy Consumption and Solar Power Generation at October 7, 2016

In [25]:
plt.figure(figsize=(20,7))
plt.title("Overall House Energy Consumption and Solar Power Generation at October 7, 2016")
sns.lineplot(data = data.loc['2016-10-07 00:00':'2016-10-07 23:59'].filter(items=['House overall [kW]', 'Solar [kW]']
                                                                        ).resample('H').sum(), dashes=False)
Out[25]:
<matplotlib.axes._subplots.AxesSubplot at 0x2404a858280>

From the above plot, the balance between overall house energy consumption and solar power generation is 9:00 and 13:30.

Comparing Overall House Energy Consumption and Solar Power Generation per Month

In [26]:
plt.figure(figsize=(20,7))
plt.title("Overall House Energy Consumption and Solar Power Generation per Month")
sns.lineplot(data = data.filter(items=['House overall [kW]', 'Solar [kW]']).resample('M').sum(), dashes=False)
Out[26]:
<matplotlib.axes._subplots.AxesSubplot at 0x2404ab1fdf0>

From the above plot, overall house energy consumption is greater than solar power generation in 2016.

Forthermore, Separating house data into room data and device data

In [27]:
room_data = house_data.filter(items=['Home office [kW]', 'Wine cellar [kW]', 
                                     'Kitchen 12 [kW]', 'Kitchen 14 [kW]', 
                                     'Kitchen 38 [kW]', 'Barn [kW]',
                                     'Living room [kW]']) 
device_data = house_data.filter(items=['Dishwasher [kW]', 'Furnace 1 [kW]', 
                                       'Furnace 2 [kW]',  'Fridge [kW]',
                                       'Garage door [kW]', 'Well [kW]',
                                       'Microwave [kW]'])
room_data = room_data.sum()
device_data = device_data.sum()
print(room_data)
print(device_data)
Home office [kW]    40961.277962
Wine cellar [kW]    21233.079320
Kitchen 12 [kW]      1388.448483
Kitchen 14 [kW]      3539.012726
Kitchen 38 [kW]         4.725373
Barn [kW]           29493.633696
Living room [kW]    17794.476716
dtype: float64
Dishwasher [kW]     15806.409510
Furnace 1 [kW]      49993.062333
Furnace 2 [kW]      68924.395621
Fridge [kW]         32026.710600
Garage door [kW]     7124.847316
Well [kW]            7882.163852
Microwave [kW]       5534.440218
dtype: float64

Plotting Room Data

In [28]:
plt.figure(figsize=(20,7))
plt.title("Rooms Energy Consumption")
sns.lineplot(data = room_data, dashes=False)
Out[28]:
<matplotlib.axes._subplots.AxesSubplot at 0x2404ad8a9a0>
In [29]:
plot = room_data.plot(kind="bar", figsize=(20,7))
plot.set_title("Rooms Energy Consumption")
plot.set_ylabel('%')
Out[29]:
Text(0, 0.5, '%')
In [30]:
import plotly.graph_objects as go
fig = go.Figure(
    data=[go.Bar(y=room_data, x=['Home office [kW]', 'Wine cellar [kW]', 
                                 'Kitchen 12 [kW]', 'Kitchen 14 [kW]', 
                                 'Kitchen 38 [kW]', 'Barn [kW]',
                                 'Living room [kW]'])],
    layout_title_text="Room Energy Consumption"
)
fig.show()

From above plots: home office has the highest consumption, which is 40.96128 kW; kitchen 38 has lowest energy consumption, which is 0 kW.

In [31]:
plot = room_data.plot(kind="pie", autopct='%.2f', figsize=(7,7))
plot.set_title("Rooms Energy Consumption")
plot.set_ylabel('%')
Out[31]:
Text(0, 0.5, '%')

Plotting Device Data

In [32]:
plt.figure(figsize=(20,7))
plt.title("Devices Energy Consumption")
sns.lineplot(data = device_data, dashes=False)
Out[32]:
<matplotlib.axes._subplots.AxesSubplot at 0x2404ce29040>
In [33]:
plot = device_data.plot(kind="bar", figsize=(20,7))
plot.set_title("Devices Energy Consumption")
plot.set_ylabel('%')
Out[33]:
Text(0, 0.5, '%')
In [34]:
import plotly.graph_objects as go
fig = go.Figure(
    data=[go.Bar(y=device_data, x=['Dishwasher [kW]', 'Furnace 1 [kW]', 
                                   'Furnace 2 [kW]',  'Fridge [kW]',
                                   'Garage door [kW]', 'Well [kW]',
                                   'Microwave [kW]'])],
    layout_title_text="Devices Energy Consumption"
)
fig.show()

From above plots, Furnace 2 has the highest energy consumption, which is 68.9244 kW; Microwave has the lowest energy consumption, which is 5.53444 W.

In [35]:
plot = device_data.plot(kind="pie", autopct='%.2f', figsize=(7,7))
plot.set_title("Devices Energy Consumption")
plot.set_ylabel('%')
Out[35]:
Text(0, 0.5, '%')

Conclusion:

On October 7, 2016, the highest overall house energy consumption was at 6:00; the lowest overall house energy consumption was at 13:00. The higher house energy consumption was from 6:00 to 12:00. During this period time, living room and barn had higher energy consumption and was quite lively. Solar generated the stronger power between 11:00 and 13:00. The balance between overall house energy consumption and solar power generation was 9:00 and 13:30

So, for each day, focusing on decrease energy consumption in the morning.

For overall 2016, the highest energy consumption was in August and September; the lowest energy consumption was in July and December. The furnace 2 and 1 had the higher energy consumption before May 2016. Solar generated the strongest power in July; solar generated the weakest power in December and January. Overall house energy consumption was greater than solar power generation in 2016.

So, for each month, focusing on decrease energy consumption in summer and winter. Because overall house energy consumption was much greater than solar power generation, we still need to save energy not depend on solar power.

For rooms, home office had the highest consumption, which was 40.96128 kW; kitchen 38 had lowest energy consumption, which was 0 kW. For devices, Furnace 2 had the highest energy consumption, which was 68.9244 kW; Microwave had the lowest energy consumption, which was 5.53444 kW.

So, furnance had the highest energy consumption. Microwave had the lowest energy consumption. for decrease energy consumption, we can reduce use of furnances.

In [ ]: